#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
//写文件
int main()
{
    int cnt = 10;
    FILE *fp = fopen("test.txt", "w");
    if(fp == NULL)
    {
        perror("fopen");
        exit(1);
    }
    char buf[1024] = "hello_word!\n";
    while(cnt--)
    {
        fwrite(buf, 1, strlen(buf), fp);
        sleep(1);
    }
    fclose(fp);
    return 0;
}